using System;
namespace Coding4Fun.Phone.Controls.Primitives
{
	public abstract class TimeSpanPickerBasePage : ValuePickerBasePage<TimeSpan>, ITimeSpanPickerPage<TimeSpan>, IValuePickerPage<TimeSpan>
	{
		public TimeSpan Max
		{
			get;
			set;
		}
		public TimeSpan IncrementStep
		{
			get;
			set;
		}
		public override TimeSpan? Value
		{
			set
			{
				TimeSpan? timeSpan = value;
				TimeSpan max = this.Max;
				base.Value = ((timeSpan.get_HasValue() && timeSpan.GetValueOrDefault() > max) ? new TimeSpan?(this.Max - this.IncrementStep) : value);
			}
		}
		protected override ValueWrapper<TimeSpan> GetNewWrapper(TimeSpan? value)
		{
			return new TimeSpanWrapper(value.GetValueOrDefault(TimeSpan.FromMinutes(30.0)));
		}
	}
}
